<template>
    <div>
        <!-- <dwmanager ref='dwmanager' @onReshdws="GetZbByIdFunc"></dwmanager> -->
        <div class="head-box" style="height: 100px;">
            <BreadcrumbA></BreadcrumbA>
            <!-- <ul class="navbar-right">
                <li class="button" title="管理党委 " @click="mangerment">
                    <a href="javascript:;" class="speech-button"><i class="el-icon-setting"></i></a>
                </li>
                <li class="button" title="管理业务 " @click="$router.push('/manage')">
                    <a href="javascript:;" class="speech-button"><i class="el-icon-edit-outline"></i></a>
                </li>
            </ul> -->
            <div class="comwid clearfix">
                <div class="head-logo lf">
                    <img src="../images/bg.jpg" style="width: 100%;">
                </div>
            </div>
        </div>
        <el-row style="margin-top: 20px;">
            <div class="mytitle">内蒙古自治区测绘地理信息局党组织</div>
        </el-row>
        <div id="chart-container">
            <div class="orgchart">
                <table>
                    <tbody>
                        <tr>
                            <td :colspan="colspan">
                                <div class="portfolio-item ">
                                    <div class="single-portfolio">
                                        <div class="div_tou">
                                            <div style="margin-right: 30px;height:150px; float:left;cursor: pointer;" @click="switchTojudangwei">
                                                <img class="img1" style="width:100px; margin-left:10%;" :src="$store.state.images.danghui">
                                            </div>
                                            <div style="height:150px; float:right">
                                                <p class="span_Introduction" slot="content">
                                                    <span id="content" style="display: block;text-indent: 2em; text-align: left; font-size: 15px; font-weight: bold;">
                                                        欢迎您来到{{dwValue.name}}，{{dwValue.alias}}成立于{{dwValue.createtime}}年，
                                                        共有{{dwValue.dwcount}}个党委会，
                                                        {{dwValue.dzzcount}}个党总支，
                                                        {{dwValue.dzbcount}}个党支部，
                                                        截止目前共有{{dwValue.allpersons}}人，
                                                        其中党员{{dwValue.alldypersons}}人
                                                        (在职党员{{dwValue.dyzzperson}}人，离退休党员{{dwValue.dytxperson}}人，
                                                        男党员{{dwValue.dymanperson}}人，女党员{{dwValue.dywomanperson}}人)，
                                                        非正式党员{{dwValue.allfdypersons}}人
                                                        (预备党员{{dwValue.fdyyb}}人，入党积极份子{{dwValue.fdyjj}}人，
                                                        重点培养对象{{dwValue.fdyzzdx}}人)。
                                                        <i @click="playmusic" class="ivu-icon ivu-icon-ios-megaphone"
                                                            style="font-size: 19px;cursor: pointer;display: unset;"></i>
                                                    </span>

                                                </p>
                                            </div>
                                        </div>

                                    </div>
                                </div>
                            </td>
                        </tr>
                        <tr class="lines">
                            <td :colspan="colspan">
                                <div class="down"></div>
                            </td>
                        </tr>
                        <tr class="lines">
                            <td class="right">&nbsp;</td>
                            <td :class="child2.class" v-for="(child2, index2)  in childsClass" :key='index2'>&nbsp;</td>
                            <td class="left ">&nbsp;</td>
                        </tr>
                        <tr class="nodes">
                            <td colspan="2" v-for="(child, index)  in childs" :key='index'>
                                <table style="margin-left:10px">
                                    <tbody>
                                        <tr>
                                            <td colspan="4">
                                                <div class="portfolio-item ">
                                                    <div class="single-portfolio">
                                                        <figure class="css-hover-effect">
                                                            <figcaption class="figure-caption">
                                                                <div class="figure-dg">
                                                                    <a data-toggle="modal" data-target="#portfolioModal1"
                                                                        href="#">
                                                                        <img :src="$store.state.images.danghui">
                                                                    </a>
                                                                </div>
                                                                <div class="figure-info">
                                                                    <h2 @click="switchTo(child.dwid,child.alias)">
                                                                        <a href="">中共内蒙古自治区</a>
                                                                        <br>
                                                                        <a href="">{{child.alias}}</a>
                                                                    </h2>
                                                                </div>
                                                            </figcaption>
                                                        </figure>
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</template>
<script>
    import Common from "../js/Common.js";
    // import dwmanager from './manager/dwmanager.vue';
    import {
        mapActions
    } from 'vuex';
    export default {
        data() {
            return {
                pStyle: {
                    fontSize: '16px',
                    color: 'rgba(0,0,0,0.85)',
                    lineHeight: '24px',
                    display: 'block',
                    marginBottom: '16px'
                },
                parent: {},
                childs: [], //局下面的全部委员会
                dwValue: {}, //党委基本描述信息
                childsClass: [],
                colspan: 0,
            };
        },
        components: {
            // dwmanager,
        },
        mounted() {
            if (this.GetUser() == false) {
                this.$router.push("/");
            }
            this.GetActiveDwId_DzbId();
            this.GetZbByIdFunc();

            this.WriteActivebreadcrumb({
                name:'view',
                value:'测绘地理信息局委员会',
                params:{
                    dwid:-1,
                    dzbid:-1
                }
            })
        },
        watch: {
            "childs": {
                handler() {
                    if (this.childs.length > 0) {
                        this.childsClass = [];
                        for (let index = 0; index < this.childs.length - 1; index++) {
                            this.childsClass.push({
                                class: 'left top'
                            });
                            this.childsClass.push({
                                class: 'right top'
                            });
                        }
                        this.colspan = 2 * this.childs.length;
                    }
                },
                deep: true
            }
        },
        methods: {
            ...mapActions(['GetZbById', 'Getzbdetails', 'GetUser', 'GetActiveDwId_DzbId', 'WriteActiveDwId_DzbId','WriteActivebreadcrumb']),
            GetZbByIdFunc() {
                let _this = this;
                this.GetZbById()
                    .then(function (e) {
                        if (typeof e === "object") {
                            _this.parent = e.PostThis;
                            _this.childs = e.childs;
                            // _this.$refs.dwmanager.$data.alldws = _this.childs;
                            _this.GetzbdetailsFunc();
                        }
                    });

            },
            GetzbdetailsFunc() {
                let _this = this;
                this.Getzbdetails()
                    .then(function (e) {
                        if (typeof e === "object") {
                            _this.dwValue = e;
                        }
                    })
            },
            playmusic(src) {
                var content = document.getElementById("content").innerText;
                var url = "http://tts.baidu.com/text2audio?lan=zh&per=1&ie=UTF-8&text=" + encodeURI(content);
                var audio = new Audio(url);
                audio.src = url;
                Common.musicObject.playmusic(url);
            },
            switchTo(dwid,alias) {
                this.WriteActiveDwId_DzbId({dwid: dwid,dzbid: -1});
                // this.WriteActivebreadcrumb({
                //     type:'dw',
                //     value:alias,
                //     dwid: dwid,
                //     dzbid: -1
                // });
                this.$router.push({
                    name: "dw",
                });
            },
            switchTojudangwei() {
                this.WriteActiveDwId_DzbId({dwid:-1,dzbid:-1});
                // this.WriteActivebreadcrumb({
                //     type:'dzb',
                //     name:'classify',
                //     value:this.dwValue.alias,
                //     dwid: -1,
                //     dzbid: -1
                // });
                this.$router.push({
                    name: "classify",
                })

            },
            mangerment() {
                //0为超级管理员  1 为管理自己委员会  2 为管理自己支部  3为普通党员
                this.$refs.dwmanager.$data.dialogVisible = true;
                this.$refs.dwmanager.$data.title = '党委编辑';
            },
        },
    }
</script>
<style>
    .flaticon-slanting1 {
        background-color: #28176b;
    }

    .link>span {
        font-weight: 400 !important;
        color: #303133 !important;
    }

    .link>span:hover {
        color: #409EFF !important;
        cursor: pointer !important;
    }

    .nowwehre>span {
        font-weight: 700 !important;
    }

    .navbar-right {
        float: right !important;
    }

    .navbar-right>li.button {
        /* padding: 10px 6px; */
        float: left;
    }

    .navbar-right>li {
        position: relative;
        display: block;
    }

    .navbar-right>li>a {
        position: relative;
        display: block;
        line-height: 20px;
        color: #fff;
        -webkit-border-radius: 2px;
        padding: 4px;
        /* border: 1px solid rgba(0, 0, 0, 0.15); */
        width: 30px;
        box-shadow: 1px 1px 0 rgba(255, 255, 255, 0.2) inset;
        text-align: center;
    }

    .navbar-right>li.button>a>i {
        display: block;
        font-size: 20px;
        color: #606266;
    }

    .mytitle {
        width: 100%;
        font-size: 34px;
        text-align: center;
        color: #f10e0e;
        font-weight: 700;
    }

    #chart-container {
        position: relative;
        display: inline-block;
        top: 10px;
        left: 10px;
        /* height: 420px; */
        width: calc(100% - 24px);
        /* border: 2px dashed #aaa; */
        border-radius: 5px;
        overflow: auto;
        text-align: center;
    }

    .orgchart {
        display: inline-block;
        min-height: 202px;
        min-width: 202px;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        background-image: linear-gradient(90deg, rgba(200, 0, 0, 0.15) 10%, rgba(0, 0, 0, 0) 10%), linear-gradient(rgba(200, 0, 0, 0.15) 10%, rgba(0, 0, 0, 0) 10%);
        background-size: 10px 10px;
        border: 1px dashed transparent;
        padding: 20px;
    }

    .orgchart {
        background: #fff;
    }

    .orgchart *,
    .orgchart *:before,
    .orgchart *:after {
        -webkit-box-sizing: border-box;
        -moz-box-sizing: border-box;
        box-sizing: border-box;
    }

    .orgchart table {
        border-spacing: 0 !important;
        border-collapse: separate !important;
    }

    .orgchart>table:first-child {
        margin: 20px auto;
    }

    .orgchart td {
        /* text-align: left; */
        vertical-align: top;
        padding: 0;
    }

    .orgchart .node {
        display: inline-block;
        position: relative;
        margin: 0;
        padding: 3px;
        border: 2px dashed transparent;
        text-align: center;
        width: 130px;
    }

    .orgchart .node {
        transition: all .3s;
        webkit-transition: all .3s;
        opacity: 1;
        top: 0;
        left: 0;
    }

    .orgchart .node .title {
        text-align: center;
        font-size: 12px;
        font-weight: 700;
        height: 20px;
        line-height: 20px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        background-color: rgba(217, 83, 79, .8);
        color: #fff;
        border-radius: 4px 4px 0 0;
    }

    .orgchart .node .content {
        width: 100%;
        height: 20px;
        font-size: 11px;
        line-height: 18px;
        border: 1px solid rgba(217, 83, 79, .8);
        border-radius: 0 0 4px 4px;
        text-align: center;
        background-color: #fff;
        color: #333;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .orgchart .node .title .symbol {
        float: left;
        margin-top: 4px;
        margin-left: 2px;
    }

    .orgchart td>.down {
        background-color: rgba(217, 83, 79, .8);
        margin: 0 auto;
        height: 20px;
        width: 2px;
        float: none;
    }

    .orgchart td>.down {
        background-color: #aaa;
    }

    .orgchart td.right {
        border-right: 1px solid rgba(217, 83, 79, .8);
        float: none;
    }

    .orgchart td.left {
        border-left: 1px solid rgba(217, 83, 79, .8);
        float: none;
    }

    .orgchart td.top {
        border-top: 2px solid rgba(217, 83, 79, .8);
    }

    .orgchart td.left,
    .orgchart td.right,
    .orgchart td.top {
        border-color: #aaa;
    }

    /* scoped */
    .section-padding {
        padding-top: 50px;
        /* padding: 100px 0; */
    }

    @media (min-width: 1200px) {
        .container {
            width: 1170px;
        }
    }

    .container {
        padding-right: 15px;
        padding-left: 15px;
        margin-right: auto;
        margin-left: auto;
    }

    .row {
        margin-right: -15px;
        margin-left: -15px;
    }

    .row:before {
        display: table;
        content: " ";
    }

    .row:after {
        clear: both;
    }

    .portfolio-item {
        display: inline-block;
        /* margin-bottom: 30px;
        min-height: 270px; */
    }

    figure.css-hover-effect {
        border-radius: 18px;

        background: url(../images/zbtb.jpg) no-repeat;


        /*background: #b11118;*/

        /* background: -moz-linear-gradient(45deg, #8c63d4 42%, #6d9ce5 88%); */
        /*  background: -moz-linear-gradient(45deg, #bbb9bf 42%, #9fafc7 88%);
        background: -webkit-gradient(linear, left bottom, right top, color-stop(42%, #bbb9bf), color-stop(88%, #9fafc7));
        background: -webkit-linear-gradient(45deg, #bbb9bf 42%, #9fafc7 88%); 
        background: -o-linear-gradient(45deg, #bbb9bf 42%, #9fafc7 88%);
        background: -ms-linear-gradient(45deg, #bbb9bf 42%, #9fafc7 88%);
        background: linear-gradient(45deg, #bbb9bf 42%, #9fafc7 88%); */
        filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#bbb9bf', endColorstr='#9fafc7', GradientType=1);
        position: relative;
        overflow: hidden;
    }

    figure {
        margin: 0;
    }

    figcaption,
    figure,
        {
        display: block;
    }

    figure.css-hover-effect img {
        /* width: 100%; */
        opacity: 1;
        -webkit-transition: opacity .35s;
        -moz-transition: opacity .35s;
        -o-transition: opacity .35s;
        transition: opacity .35s;
        width: 240px;
        height: 180px;
        position: relative;
    }

    figure.css-hover-effect:hover img {
        opacity: .2
    }

    .figure-caption {

        position: absolute;
        top: 0px;
        left: 0px;
        width: 100%;
        height: 100%;
    }


    figure .figure-link {
        position: absolute;
        top: 10px;
        right: 10px;
    }

    figure .figure-dg {
        position: absolute;
        top: 20px;
        left: 90px;
    }

    figure .figure-link a:hover {
        text-decoration: none
    }

    figure .figure-link a i:hover {
        background-color: #fff;
        color: #28176b
    }

    figure .figure-link a i,
    figure .figure-dg a img {

        display: block;
        /*background: #28176b;*/
        text-align: center;
        line-height: 30px;
        color: #fff;
        font-size: 18px;
        border-radius: 3px;
        -webkit-transition: all 300ms;
        -moz-transition: all 300ms;
        -o-transition: all 300ms;
        transition: all 300ms;
    }

    figure .figure-link a i {
        width: 30px;
        height: 30px;
    }

    figure .figure-dg a img {
        width: 50px;
        height: 50px;
    }



    figure .figure-info {

        position: absolute;
        top: 45%;
        width: 100%;
        text-align: center;

    }

    figure .figure-info h2 {
        margin: 0;
        font-size: 15px;
        line-height: 22px;
        font-weight: 600
    }

    figure.css-hover-effect span {
        color: #f4f4f4;
        font-size: 12px;
        text-transform: uppercase;
        font-weight: 500
    }

    /* figure.css-hover-effect h2,
    figure.css-hover-effect span,
    figure.css-hover-effect i,
    figure.css-hover-effect .figure-dg img {
        opacity: 0;
        -webkit-transition: opacity .35s, -webkit-transform .35s;
        transition: opacity .35s, transform .35s;
        -webkit-transform: scale(1.5);
        transform: scale(1.5)
    } */
    figure.css-hover-effect i {
        opacity: 0;
        -webkit-transition: opacity .35s, -webkit-transform .35s;
        transition: opacity .35s, transform .35s;
        -webkit-transform: scale(1.5);
        transform: scale(1.5)
    }

    figure.css-hover-effect:hover h2,
    figure.css-hover-effect:hover span,
    figure.css-hover-effect:hover .figure-link i,
    figure.css-hover-effect:hover .figure-dg img {
        opacity: 1;
        -webkit-transform: scale3d(1, 1, 1);
        transform: scale3d(1, 1, 1)
    }

    figure .figure-info h2 a {
        font-size: 18px;
        color: #9b0103;
        text-decoration: none;
    }

    .fade {
        opacity: 0;
        -webkit-transition: opacity .15s linear;
        -o-transition: opacity .15s linear;
        transition: opacity .15s linear;
    }

    .modal {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 1040;
        display: none;
        overflow: hidden;
        -webkit-overflow-scrolling: touch;
        outline: 0;
    }

    .css-hover-effect {
        width: 240px;
        height: 180px;
    }

    .portfolioModal {}

    .fade.in {
        opacity: 1;
    }

    .modal-open .modal {
        overflow-x: hidden;
        overflow-y: auto;
    }

    .div_tou {
        background: url(../images/bjtou.jpg) no-repeat center;
        width: 600px;
        height: 150px;
        border: 3px solid #c54343;
        display: flex;
    }

    .img1 {
        float: left;
        margin-top: 15px;
        width: 80px;
        margin-left: 30px;
    }

    ._span {

        font-size: 18px;
        margin-top: 10px;
    }
</style>